package com.example.fw;

public class ContactObject {
	public String firstname;
	public String lastname;
	public String address;
	public String ph_home;
	public String ph_mobile;
	public String ph_work;
	public String email;
	public String email2;
	public String bday;
	public String bmonth;
	public String byear;
	public String group;
	public String address2;
	public String phone2;
	public String id;
	
	public ContactObject() {
	}
	
	public static String[] MONTHS = new String[]{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

	public ContactObject(ContactObject contactObject) {
		this.firstname = contactObject.firstname;
		this.lastname = contactObject.lastname;
		this.address = contactObject.address;
		this.ph_home = contactObject.ph_home;
		this.ph_mobile = contactObject.ph_mobile;
		this.ph_work = contactObject.ph_work;
		this.email = contactObject.email;
		this.email2 = contactObject.email2;
		this.bday = contactObject.bday;
		this.bmonth = contactObject.bmonth;
		this.byear = contactObject.byear;
		this.group = contactObject.group;
		this.address2 = contactObject.address2;
		this.phone2 = contactObject.phone2;
		this.id = contactObject.id;
	}
	
	public String getName() {
		return firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public String getAddress() {
		return address;
	}
	public String getHomePhone() {
		return ph_home;
	}
	public String getMobilePhone() {
		return ph_mobile;
	}
	public String getWorkPhone() {
		return ph_work;
	}
	public String getEmail() {
		return email;
	}
	public String getEmail2() {
		return email2;
	}
	public String getBirthDay() {
		return bday;
	}
	public String getBirthMonth() {
		return bmonth;
	}
	public String getBirthYear() {
		return byear;
	}
	public String getGroup() {
		return group;
	}
	public String getAddress2() {
		return address2;
	}
	public String getPhone2() {
		return phone2;
	}
	public String getContactId() {
		return id;
	}
	
	public ContactObject setName(String name) {
		this.firstname = name;
		return this;
	}
	public ContactObject setLastname(String lastname) {
		this.lastname = lastname;
		return this;
	}
	public ContactObject setAddress(String address) {
		this.address = address;
		return this;
	}
	public ContactObject setHomePhone(String ph_home) {
		this.ph_home = ph_home;
		return this;
	}
	public ContactObject setMobilePhone(String ph_mobile) {
		this.ph_mobile = ph_mobile;
		return this;
	}
	public ContactObject setWorkPhone(String ph_work) {
		this.ph_work = ph_work;
		return this;
	}
	public ContactObject setEmail(String email) {
		this.email = email;
		return this;
	}
	public ContactObject setEmail2(String email2) {
		this.email2 = email2;
		return this;
	}
	public ContactObject setBirthDay(String bday) {
		this.bday = bday;
		return this;
	}
	public ContactObject setBirthMonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}
	public ContactObject setBirthYear(String byear) {
		this.byear = byear;
		return this;
	}
	public ContactObject setGroup(String group) {
		this.group = group;
		return this;
	}
	public ContactObject setAddress2(String address2) {
		this.address2 = address2;
		return this;
	}
	public ContactObject setPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}
	public ContactObject setContactId(String id) {
		this.id = id;
		return this;
	}
	
	@Override
	public String toString() {					
		return "Cont[" + id + ": " + firstname + "]";
	}

	@Override
	public int hashCode() {		//lesson 3 58:00
		final int prime = 31;
		int result = 1;
		//result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((firstname == null) ? 0 : firstname.hashCode());
		return result;
	}
	
	@Override						//lesson 3 58:00
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactObject other = (ContactObject) obj;
		if (firstname == null) {
			if (other.firstname != null)
				return false;
		} else if (!firstname.equals(other.firstname))
			return false;
		if (id != null && other.id != null) 
				return id.equals(other.id);
		return true;
	}
}